<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查询商品列表</title>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<style type="text/css">
body{background-color: #EEEEEE;margin:0px;padding:0px;}
#img_ul{list-style-type:none;margin: 0px;padding: 0px}
#img_ul li{text-align:center;}
#img_content{position:relative; height:600px;width:100%;}
#img_content hr{color:#2E3340;height: 1px;width:100%;}
#b_id{margin:10px 0px 0px 25px; font-size: 14px;color:black;}
#paging_id{  
	position: absolute;
	right:50px;
	bottom:30px;
}
#paging_id #initnum_id{width:20px;}
</style>
<script type="text/javascript">
	function pageup(){
		var pageNow =document.getElementById("initnum_id").value;
		if(pageNow!=""){
			pageNow = parseInt(document.getElementById("initnum_id").value);
		}else{pageNow=1;}
		if(pageNow>1){pageNow--;}else{return;}
		document.getElementById("initnum_id").value=pageNow;
		document.itemsForm.action="${pageContext.request.contextPath }/items/showItems.action";
		document.itemsForm.submit();
	}
	
	function pagedown(){
		var pageNow =document.getElementById("initnum_id").value;
		var totalPageCount = document.getElementById("totalPageCount_id").value;		

		if(pageNow!=""){
			pageNow = parseInt(document.getElementById("initnum_id").value);
		}else{pageNow=1;}
		pageNow++;
		if(pageNow>totalPageCount){pageNow=totalPageCount;return;}
		document.getElementById("initnum_id").value=pageNow;
		document.itemsForm.action="${pageContext.request.contextPath }/items/showItems.action";
		document.itemsForm.submit();
	}
	function page_write(){
		var pageNow =document.getElementById("initnum_id").value;
		if(pageNow!=""){
			pageNow = parseInt(document.getElementById("initnum_id").value);
		}else{pageNow=1;}
		
		document.getElementById("initnum_id").value=pageNow;
		document.itemsForm.action="${pageContext.request.contextPath }/items/showItems.action";
		document.itemsForm.submit();
	}
</script>
</head>
<body>
<div id="img_content">
<div id="b_id">您现在的位置：产品中心</div>
<hr/>
	<form name="itemsForm" action="" method="post" enctype="multipart/form-data">
	<c:forEach items="${itemsList}" var="items">
			<div style="float:left;width:250px; height:250px;margin: 5px;">
				<ul id="img_ul">
					<li>
					<c:if test="${items.pic2 !=null}">
					<img src="/pic2/${items.pic2}" width="250px" height="180PX"/>
					</c:if>	
					</li>
					<li>${items.name}</li>
				</ul>	
			</div>	
		</c:forEach>
		<div id="paging_id">
		<input type="button" value="上一页" onclick="pageup()"/>
		<input type="button" value="下一页" onclick="pagedown()"/>
		<input type="text" name="itemsCustom.producttype" value="${$producttype}" style="display: none;"/>
		<input type="text" id="totalPageCount_id" value="${$totalPageCount}" style="display: none;"/>
		<input type="text" name="pageSize" value="8" style="display: none;"/>
		<input type="text" id="initnum_id" name="pageNow" value="${$pageNow}"/>/<span>${$totalPageCount}</span>页
		<input type="button" value="go" onclick="page_write()"/>
		</div>
	</form>	
</div>	
</body>
</html>